<template>
  <div>
    <div class="table-operator" style="margin-top: 8px" v-if="stage !== '05010' && stage !== '05050'">
      <a-button @click="downLoadTemplete()" type="primary" icon="download">
        选择模板
      </a-button>
      <a-upload name="file" :showUploadList="false" :data="queryParam" :multiple="false" :headers="tokenHeader"
                :action="importExcelUrl" @change="handleImportExcel"
                accept=".xlsx, .xls">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-button type="primary" icon="download" @click="OnExportList">导出</a-button>
    </div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      class="table_header_blue"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange"
    >
    </a-table>
    <TempleteDownload ref="templeteDownload" :type="type" />
  </div>
</template>
<script>
import columns from './indexColumns'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TempleteDownload from '@views/sj/sjxmzygl/commView/wtqd/templeteDownload.vue'

export default {
  name: 'wtqdModal',
  mixins: [JeecgListMixin],
  components: { TempleteDownload },
  props: ['id', 'stage'],
  data() {
    return {
      queryParam: {
        proId: this.id
      },
      type: 'sjwtqd',
      columns: columns(this),
      visible: false,
      loading: false,
      dataSource: [],
      url: {
        list: '/sjxmzygl/sjWorkZtfaProblem/queryListOfIssues',
        exportTemp: '/xtsz/sjWordTemplate/list',
        exportList: '/sjxmzygl/sjWorkZtfaProblem/exportProblemList',
        importExcelUrl: '/sjxmzygl/sjWorkZtfaProblem/importExcel'
      }
    }
  },
  created() {
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    close() {
      this.visible = false
    },

    downLoadTemplete() {
      this.$refs.templeteDownload.disableSubmit = false
      this.$refs.templeteDownload.init()
    }
  }
}
</script>

<style lang="less" scoped>
@import '~@assets/less/tableTheme.less';
//@import '../../../css/checkAndEdit.less';

/*.table-header {
  margin-bottom: 10px;

  .table-title {
    font-weight: bold;
    margin-left: 15px;
  }
}*/
</style>
